﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:u="clr-namespace:SLPropertyGrid" 
    xmlns:PacketViewer="clr-namespace:MavlinkDebugger.PacketViewer" 
    xmlns:PacketViewer1="clr-namespace:MavlinkPacketViewer.PacketViewer">

    <!-- PropertyGridLabel-->
    <Style TargetType="u:PropertyGridLabel">
        <Setter Property="IsEnabled" Value="true" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Cursor" Value="Arrow" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="u:PropertyGridLabel">
                    <Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
                        <ContentControl  
									ContentTemplate="{TemplateBinding ContentTemplate}" 
									Cursor="{TemplateBinding Cursor}" 
									HorizontalAlignment ="Stretch"
									HorizontalContentAlignment="Stretch" 
									FontFamily="{TemplateBinding FontFamily}" 
									FontSize="{TemplateBinding FontSize}" 
									FontStretch="{TemplateBinding FontStretch}" 
									Foreground="{TemplateBinding Foreground}" 
									Margin="5,0,0,0" 
									VerticalAlignment="Center"
									VerticalContentAlignment="Center">
                            <ContentPresenter Content="{TemplateBinding Content}"/>
                        </ContentControl>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- PropertyGrid -->
    <Style TargetType="PacketViewer1:PropertyGrid">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PacketViewer1:PropertyGrid">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="80" />
                        </Grid.RowDefinitions>
                        <ScrollViewer x:Name="LayoutRoot"
									Margin="0"
									Padding="0"
									BorderBrush="{TemplateBinding GridBorderBrush}"
									BorderThickness="{TemplateBinding GridBorderThickness}"
									HorizontalAlignment="Stretch"
									VerticalAlignment="Stretch"
									HorizontalContentAlignment="Stretch"
									VerticalContentAlignment="Stretch"
									HorizontalScrollBarVisibility="Disabled"
									VerticalScrollBarVisibility="Auto"
									>
                            <Grid x:Name="MainGrid" VerticalAlignment="Top">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="16"/>
                                    <!--<ColumnDefinition Width="{TemplateBinding DefaultLabelWidth}" MinWidth="50"/> DefaultLabelWidth wasn't working so I just default to 1/3 -->
                                    <ColumnDefinition Width="*" MinWidth="50"/>
                                    <ColumnDefinition Width="2*" />
                                </Grid.ColumnDefinitions>
                            </Grid>
                        </ScrollViewer>
                        <TextBlock x:Name="Description" Text="Description" Grid.Row="1" TextWrapping="Wrap" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>